// 导入主题样式
@use './themes.scss';

// 全局样式重置
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--el-bg-color-page);
  color: var(--el-text-color-primary);
  line-height: 1.6;
}

// 工具类
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.text-ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

// 间距工具类
.m-0 { margin: 0; }
.mt-0 { margin-top: 0; }
.mr-0 { margin-right: 0; }
.mb-0 { margin-bottom: 0; }
.ml-0 { margin-left: 0; }

.m-1 { margin: 8px; }
.mt-1 { margin-top: 8px; }
.mr-1 { margin-right: 8px; }
.mb-1 { margin-bottom: 8px; }
.ml-1 { margin-left: 8px; }

.m-2 { margin: 16px; }
.mt-2 { margin-top: 16px; }
.mr-2 { margin-right: 16px; }
.mb-2 { margin-bottom: 16px; }
.ml-2 { margin-left: 16px; }

.p-0 { padding: 0; }
.pt-0 { padding-top: 0; }
.pr-0 { padding-right: 0; }
.pb-0 { padding-bottom: 0; }
.pl-0 { padding-left: 0; }

.p-1 { padding: 8px; }
.pt-1 { padding-top: 8px; }
.pr-1 { padding-right: 8px; }
.pb-1 { padding-bottom: 8px; }
.pl-1 { padding-left: 8px; }

.p-2 { padding: 16px; }
.pt-2 { padding-top: 16px; }
.pr-2 { padding-right: 16px; }
.pb-2 { padding-bottom: 16px; }
.pl-2 { padding-left: 16px; }

// 自定义滚动条
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--el-fill-color-lighter);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--el-border-color-darker);
  border-radius: 4px;
  
  &:hover {
    background: var(--el-border-color-dark);
  }
}

// 页面布局
.page-container {
  height: 100vh;
  overflow: hidden;
}

.auth-container {
  height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 400px;
  padding: 40px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.dashboard-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.dashboard-header {
  height: 60px;
  background: var(--el-bg-color);
  border-bottom: 1px solid var(--el-border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.dashboard-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.dashboard-sidebar {
  width: 240px;
  background: var(--el-bg-color);
  border-right: 1px solid var(--el-border-color);
  overflow-y: auto;
}

.dashboard-content {
  flex: 1;
  overflow: auto;
  background: var(--el-bg-color-page);
}

// 响应式设计
@media (max-width: 768px) {
  .auth-card {
    width: 90%;
    margin: 0 20px;
    padding: 30px 20px;
  }
  
  .dashboard-sidebar {
    width: 200px;
  }
  
  .dashboard-header {
    padding: 0 16px;
  }
}

// 动画
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}

.slide-enter-active,
.slide-leave-active {
  transition: transform 0.3s ease;
}

.slide-enter-from {
  transform: translateX(-100%);
}

.slide-leave-to {
  transform: translateX(100%);
}

@import './mixins.scss';
@import './common.scss';

// ==================== Element Plus 组件夜间模式适配 ====================

// MessageBox 组件夜间模式适配
.el-message-box {
  background-color: var(--el-bg-color) !important;
  border: 1px solid var(--el-border-color) !important;
  box-shadow: var(--el-box-shadow) !important;
  width: 480px !important;
  max-width: 90vw !important;

  .el-message-box__header {
    background-color: var(--el-bg-color) !important;
    border-bottom: 1px solid var(--el-border-color-light) !important;

    .el-message-box__title {
      color: var(--el-text-color-primary) !important;
    }

    .el-message-box__headerbtn {
      color: var(--el-text-color-secondary) !important;

      &:hover {
        color: var(--el-text-color-primary) !important;
      }
    }
  }

  .el-message-box__content {
    background-color: var(--el-bg-color) !important;
    color: var(--el-text-color-primary) !important;
    padding: 20px 24px !important;
    width: 100% !important;
    .el-message-box__message {
      color: var(--el-text-color-primary) !important;
      margin-bottom: 16px !important;
    }

    .el-message-box__input {
      width: 100% !important;
      margin-top: 8px !important;

      input[type="text"] {
        width: 100% !important;
        padding: 10px 12px !important;
        background-color: var(--el-fill-color-blank) !important;
        border: 1px solid var(--el-border-color) !important;
        border-radius: 6px !important;
        color: var(--el-text-color-primary) !important;
        font-size: 14px !important;
        box-sizing: border-box !important;

        &:hover {
          border-color: var(--el-border-color-hover) !important;
        }

        &:focus {
          border-color: var(--el-color-primary) !important;
          box-shadow: 0 0 0 2px var(--el-color-primary-light-9) !important;
          outline: none !important;
        }

        &::placeholder {
          color: var(--el-text-color-placeholder) !important;
        }
      }

      .el-input {
        width: 100% !important;

        .el-input__wrapper {
          width: 100% !important;
          padding: 10px 12px !important;
          background-color: var(--el-fill-color-blank) !important;
          border: 1px solid var(--el-border-color) !important;
          border-radius: 6px !important;

          &:hover {
            border-color: var(--el-border-color-hover) !important;
          }

          &.is-focus {
            border-color: var(--el-color-primary) !important;
            box-shadow: 0 0 0 2px var(--el-color-primary-light-9) !important;
          }

          .el-input__inner {
            width: 100% !important;
            padding: 0 !important;
            background-color: transparent !important;
            color: var(--el-text-color-primary) !important;
            font-size: 14px !important;
            border: none !important;
            outline: none !important;

            &::placeholder {
              color: var(--el-text-color-placeholder) !important;
            }
          }
        }
      }
    }
  }

  .el-message-box__btns {
    background-color: var(--el-bg-color) !important;
    // border-top: 1px solid var(--el-border-color-light) !important;

    .el-button {
      &.el-button--default {
        background-color: var(--el-fill-color-blank) !important;
        border-color: var(--el-border-color) !important;
        color: var(--el-text-color-primary) !important;

        &:hover {
          background-color: var(--el-fill-color-light) !important;
          border-color: var(--el-border-color-hover) !important;
        }
      }

      &.el-button--primary {
        background-color: var(--el-color-primary) !important;
        border-color: var(--el-color-primary) !important;

        &:hover {
          background-color: var(--el-color-primary-light-3) !important;
          border-color: var(--el-color-primary-light-3) !important;
        }
      }
    }
  }
}

// Dialog 组件夜间模式适配
.el-dialog {
  background-color: var(--el-bg-color) !important;
  border: 1px solid var(--el-border-color) !important;

  .el-dialog__header {
    background-color: var(--el-bg-color) !important;
    border-bottom: 1px solid var(--el-border-color-light) !important;

    .el-dialog__title {
      color: var(--el-text-color-primary) !important;
    }

    .el-dialog__headerbtn {
      color: var(--el-text-color-secondary) !important;

      &:hover {
        color: var(--el-text-color-primary) !important;
      }
    }
  }

  .el-dialog__body {
    background-color: var(--el-bg-color) !important;
    color: var(--el-text-color-primary) !important;
  }

  .el-dialog__footer {
    background-color: var(--el-bg-color) !important;
    border-top: 1px solid var(--el-border-color-light) !important;
  }
}

// Overlay 遮罩层适配
.el-overlay {
  background-color: var(--el-overlay-color-lighter) !important;
}

// 强制修复 MessageBox 输入框宽度问题
.el-message-box .el-message-box__content .el-message-box__input,
.el-message-box__content .el-message-box__input,
.el-message-box__input {
  width: 100% !important;

  input,
  .el-input,
  .el-input__wrapper,
  .el-input__inner {
    width: 100% !important;
    box-sizing: border-box !important;
  }
}
